#ifndef __MAIN_H__
#define __MAIN_H__

    
#ifdef WIN
#include <winsock2.h>
#else
#include <arpa/inet.h>    
#include <netinet/in.h>
#include <sys/socket.h>
#include <netdb.h>
#endif
#include <netinet/in.h>

#include <errno.h>
#include <fcntl.h>
#include <signal.h>
#include <unistd.h>
#include <sys/types.h>


#define NO_FLAG 0


static const char DELIMITER = '|';
static const char* MENU_OPTIONS[4] = {  "1|DEPOSIT",
                                   "2|WITHDRAW",
                                   "3|BALANCE",
                                   "4|QUIT"};
static const int MYPORT = 39700;

static const char DEPOSIT = 'D';
static const char WITHDRAW = 'W';
static const char BALANCE = 'B';
static const char RESPONSE = 'R';

static const char ERROR = 'E';
static const char SUCCESS = 'S';


/**  Functions */
int client_connect(const char* server_address);
int client_disconnect(const char* server_address);
void client_deposit();
void client_withdraw();
void client_balance();
int menu();

int initServer();

/** Structures */
struct atm_msg{
    char account_number[33];  /*  Required */
    char command;       /*  D- deposit, W- Withdraw, B- balance, R- response */
    char amount[33];    /*  amount [0, 100 000] */
    char issuccess;     /*  If 'E' then error,  'S' Successful */
    char name [50];		/*  Account holder's name */
    char msg[100];      /*  Message to send to the user or server,
    						 this should be printed to the screen */
};

#endif /* __MAIN_H__ */
